/*
	在客户端与服务器端互相发送事件
	指定回调
*/

var http = require('http');
var sio = require('socket.io');
var fs = require('fs');

var server = http.createServer(function(req, res){
	res.writeHead(200, {'Content-type' : 'text/html'});
	res.end(fs.readFileSync('./6_emitClient.html'));
}).listen(1337);

var socketSer = sio.listen(server);

socketSer.on('connection', function(socket){
	socket.emit('setName', 'xuxuan', function(data1,data2){
		console.log(data1);
		console.log(data2);
	});
});